package com.tanhua.admin.controller;

import com.tanhua.admin.service.CashboardService;
import com.tanhua.model.vo.AnalysisSummaryVo;
import com.tanhua.model.vo.InformationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dashboard")
public class CashboardController {
    @Autowired
   private CashboardService cashboardService;
    @GetMapping("/summary")
    public ResponseEntity dashboard(){
        AnalysisSummaryVo summary = cashboardService.findSummary();
        return ResponseEntity.ok(summary);
    }


    @GetMapping("/users")
    public ResponseEntity findByTime(@RequestParam Long sd,
                                     @RequestParam Long ed,
                                     @RequestParam Integer type){
        // 调用service
        InformationVo vo = cashboardService.findByTime(sd,ed,type);
        return ResponseEntity.ok(vo);
    }
}
